package Year21_Month12.day1208;

public class Solution {
    public int numFriendRequests(int[] ages) {
        int[] arr = new int[121];
        for(int i:ages){
            arr[i]++;
        }
        int count = 0;
        for(int i = 0;i < 121;i++){
            int resA = arr[i];
            for(int j = 0;j < 121;j++){
                int resB = arr[j];
                if(i * 0.5 + 7 >= j){
                    continue;
                }
                if(j > i){
                    continue;
                }
                if(j > 100 && i < 100){
                    continue;
                }
                count += resA * resB;
                if(i == j){
                    count -= resA;
                }
            }
        }
        return count;
    }
}
